let PersonalInformation = {
    path: '/personalinformation',
    name: 'PersonalInformation',
    component: () => import('../../../views/Personal/PersonalInformation/start.vue'),
    children: [
        {
            path: '/',
            redirect: '/personalinformation/personaldata',
            // component: () => import('../../../views/Personal/PersonalInformation/PersonalData.vue'),
            // beforeEnter: (to, from, next) => {
            //     console.log(from);
            //     switch (from.name) {
            //         case 'Page1':
            //             next();
            //             break;
            //         case 'UpdatePassword':
            //             next();
            //             break;
            //         case 'JobTitleDeclare':
            //             next();
            //             break;
            //         case 'DeclareExplanation':
            //             next();
            //             break;
            //         case sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'PersonalData'):
            //             next();
            //             break;
            //     }
            // }
        },
        {
            path: 'personaldata',
            name: 'PersonalData',
            component: () => import('../../../views/Personal/PersonalInformation/PersonalData.vue'),
            beforeEnter: (to, from, next) => {
                console.log(from);
               let user = sessionStorage.getItem('user');
               if(user){
                   next();
               }


            }
        },
        {
            path: 'updatepassword',
            name: 'UpdatePassword',
            component: () => import('../../../views/Personal/PersonalInformation/UpdatePassword.vue'),
            beforeEnter: (to, from, next) => {
                // console.log(from);
                switch (from.name) {
                    case 'PersonalData':
                        next();
                        break;
                    case 'JobTitleDeclare':
                        next();
                        break;
                    case 'DeclareExplanation':
                        next();
                        break;
                    case 'ChangeRecord':
                        next();
                        break;
                    case 'Process1':
                        next();
                        break;
                    case 'Process2':
                        next();
                        break;
                    case 'Process3':
                        next();
                        break;
                    case 'Process4':
                        next();
                        break;
                    case 'Process5':
                        next();
                        break;
                    case 'Process6':
                        next();
                        break;
                    case 'Process7':
                        next();
                        break;
                    case 'Process8':
                        next();
                        break;
                    case 'Process9':
                        next();
                        break;
                    case null:
                        if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'UpdatePassword')) {
                            next();
                        };
                        break;

                }

            }
        },
        {
            path: 'jobtitledeclare',
            name: 'JobTitleDeclare',
            component: () => import('../../../views/Personal/PersonalInformation/JobTitleDeclare.vue'),
            beforeEnter: (to, from, next) => {
                // console.log(from);
                switch (from.name) {
                    case 'PersonalData':
                        next();
                        break;
                    case 'UpdatePassword':
                        next();
                        break;
                    case 'DeclareExplanation':
                        next();
                        break;
                    case 'CheckProcess':
                        next();
                        break;
                    case 'DeclareInformation':
                        next();
                        break;
                    case 'ChangeRecord':
                        next();
                        break;
                    case 'Process1':
                        next();
                        break;
                    case 'Process2':
                        next();
                        break;
                    case 'Process3':
                        next();
                        break;
                    case 'Process4':
                        next();
                        break;
                    case 'Process5':
                        next();
                        break;
                    case 'Process6':
                        next();
                        break;
                    case 'Process7':
                        next();
                        break;
                    case 'Process8':
                        next();
                        break;
                    case 'Process9':
                        next();
                        break;
                    case null:
                        if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'JobTitleDeclare')) {
                            next();
                        };
                        break;

                }

            }
        },
        {
            path: 'declareexplanation',
            name: 'DeclareExplanation',
            component: () => import('../../../views/Personal/PersonalInformation/DeclareExplanation.vue'),
            beforeEnter: (to, from, next) => {
                // console.log(from);
                switch (from.name) {
                    case 'PersonalData':
                        next();
                        break;
                    case 'JobTitleDeclare':
                        next();
                        break;
                    case 'UpdatePassword':
                        next();
                        break;
                    case 'ChangeRecord':
                        next();
                        break;
                    case 'Process1':
                        next();
                        break;
                    case 'Process2':
                        next();
                        break;
                    case 'Process3':
                        next();
                        break;
                    case 'Process4':
                        next();
                        break;
                    case 'Process5':
                        next();
                        break;
                    case 'Process6':
                        next();
                        break;
                    case 'Process7':
                        next();
                        break;
                    case 'Process8':
                        next();
                        break;
                    case 'Process9':
                        next();
                        break;
                    case null:
                        if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'DeclareExplanation')) {
                            next();
                        };
                        break;

                }


            }
        },
        {
            path: 'declareinformation',
            name: 'DeclareInformation',
            component: () => import('../../../views/Personal/PersonalInformation/JobTitle/DeclareInformation.vue'),
            beforeEnter: (to, from, next) => {
                // console.log(from);
                if (from.name == 'JobTitleDeclare') {
                    next();
                } else if (from.name == 'Process1') {
                    next();
                } else if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'DeclareInformation')) {
                    next();
                }

            }
        },
        {
            path: 'declareprocess',
            name: 'DeclareProcess',
            component: () => import('../../../views/Personal/PersonalInformation/JobTitle/DeclareProcess.vue'),
            children: [
                {
                    path: '',
                    redirect: 'process1',
                    // component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process1.vue'),
                },
                {
                    path: 'process1',
                    name: 'Process1',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process1.vue'),
                    beforeEnter: (to, from, next) => {
                        console.log(111, to, from);
                        switch (from.name) {
                            case 'Process6':
                                next();
                                break;
                            case 'Process2':
                                next();
                                break;
                            case 'Process3':
                                next();
                                break;
                            case 'Process4':
                                next();
                                break;
                            case 'Process5':
                                next();
                                break;
                            case 'Process7':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case 'DeclareInformation':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process1')) {
                                    next();
                                };
                                break;

                        }
                    }
                },
                {
                    path: 'process2',
                    name: 'Process2',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process2.vue'),
                    beforeEnter: (to, from, next) => {
                        switch (from.name) {
                            case 'Process6':
                                next();
                                break;
                            case 'Process1':
                                next();
                                break;
                            case 'Process3':
                                next();
                                break;
                            case 'Process4':
                                next();
                                break;
                            case 'Process5':
                                next();
                                break;
                            case 'Process7':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process2')) {
                                    next();
                                };
                                break;

                        }
                    }

                },
                {
                    path: 'process3',
                    name: 'Process3',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process3.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        switch (from.name) {
                            case 'Process6':
                                next();
                                break;
                            case 'Process1':
                                next();
                                break;
                            case 'Process2':
                                next();
                                break;
                            case 'Process4':
                                next();
                                break;
                            case 'Process5':
                                next();
                                break;
                            case 'Process7':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process3')) {
                                    next();
                                };
                                break;
                        }
                    }
                },
                {
                    path: 'process4',
                    name: 'Process4',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process4.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        switch (from.name) {
                            case 'Process6':
                                next();
                                break;
                            case 'Process1':
                                next();
                                break;
                            case 'Process2':
                                next();
                                break;
                            case 'Process3':
                                next();
                                break;
                            case 'Process5':
                                next();
                                break;
                            case 'Process7':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process4')) {
                                    next();
                                };
                                break;
                        }
                    }
                },
                {
                    path: 'process5',
                    name: 'Process5',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process5.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        switch (from.name) {
                            case 'Process6':
                                next();
                                break;
                            case 'Process1':
                                next();
                                break;
                            case 'Process2':
                                next();
                                break;
                            case 'Process3':
                                next();
                                break;
                            case 'Process4':
                                next();
                                break;
                            case 'Process7':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process5')) {
                                    next();
                                };
                                break;
                        }
                    }
                },
                {
                    path: 'process6',
                    name: 'Process6',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process6.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        switch (from.name) {
                            case 'Process5':
                                next();
                                break;
                            case 'Process1':
                                next();
                                break;
                            case 'Process2':
                                next();
                                break;
                            case 'Process3':
                                next();
                                break;
                            case 'Process4':
                                next();
                                break;
                            case 'Process7':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process6')) {
                                    next();
                                };
                                break;
                        }
                    }
                },
                {
                    path: 'process7',
                    name: 'Process7',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process7.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        switch (from.name) {
                            case 'Process5':
                                next();
                                break;
                            case 'Process1':
                                next();
                                break;
                            case 'Process2':
                                next();
                                break;
                            case 'Process3':
                                next();
                                break;
                            case 'Process4':
                                next();
                                break;
                            case 'Process6':
                                next();
                                break;
                            case 'Process8':
                                next();
                                break;
                            case 'Process9':
                                next();
                                break;
                            case null:
                                if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process7')) {
                                    next();
                                };
                                break;


                        }
                    }
                },
                {
                    path: 'process8',
                    name: 'Process8',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process8.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        for (let i = 1; i <= 9; i++) {
                            if (from.name == 'Process' + i) {
                                next();
                            } else if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process8')) {
                                next();

                            }
                        }



                    }
                },
                {
                    path: 'process9',
                    name: 'Process9',
                    component: () => import('../../../views/Personal/PersonalInformation/JobTitle/Process9.vue'),
                    beforeEnter: (to, from, next) => {
                        // console.log(from);
                        // console.log(from.name)
                        for (let i = 1; i <= 9; i++) {
                            if (from.name == 'Process' + i) {
                                next();
                            } else if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'Process9')) {
                                next();

                            }
                        }

                    }
                },
            ],
        },
        {
            path: 'newplaceinformation',
            name: 'NewPlaceInformation',
            component: () => import('../../../views/Personal/PersonalInformation/NewPlaceInformation.vue'),
            beforeEnter: (to, from, next) => {
                // console.log(from);
                // console.log(from.name)
                switch (from.name) {
                    case 'PersonalData':
                        next();
                        break;
                    case null:
                        if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'NewPlaceInformation')) {
                            next();
                        };
                        break;


                }
            }
        },
        {
            path: 'changerecord',
            name: 'ChangeRecord',
            component: () => import('../../../views/Personal/PersonalInformation/ChangeRecord.vue'),
            beforeEnter: (to, from, next) => {
                // console.log(from);
                // console.log(from.name)
                switch (from.name) {
                    case 'PersonalData':
                        next();
                        break;
                    case null:
                        if (sessionStorage.getItem("fName") && (sessionStorage.getItem("fName") == 'ChangeRecord')) {
                            next();
                        };
                        break;


                }
            }
        },
        {
            path: 'checkprocess',
            name: 'CheckProcess',
            component: () => import('../../../views/Personal/PersonalInformation/JobTitle/CheckProcess.vue'),
            // beforeEnter: (to, from, next) => {
            //     console.log(from);
            //     if(from.name == 'JobTitleDeclare')
            //     next();
            // }
        },
        {
            path: 'seechangerecord',
            name: 'SeeChangeRecord',
            component: () => import('../../../views/Personal/PersonalInformation/SeeChangeRecord.vue'),
        },

    ]
}
export default PersonalInformation